<template>
	<view class="details-meal">
		<!-- 头部 -->
		<!-- #ifndef MP-WEIXIN -->
		<public-header :title="title" :share="false"></public-header>
		<view class="hei_100"></view>
		 <!-- #endif -->
		<!-- end -->

		<!-- 详情 -->
		<view class="details padd_32">
			<!-- banner -->
			<image class="banner" :src="details.imageUrl"></image>
			<!-- 内容 -->
			<view class="cont">
				<view class="title">[{{details.name}}]</view>
				<view class="text">{{details.description}}</view>
				<view class="price">
					¥ {{details.price}}
					<text>（比总单价优惠 ¥{{(details.priceOrigin - details.price).toFixed(2)}}）</text><text class="fr">剩余：<text style="color: $uni-color1;">{{details.stock||0}}</text></text>
				</view>
			</view>
			<!-- 列表 -->
			<view class="list">
				<view class="name">
					<text v-if="details.enterpriseNameAndPhone">{{details.enterpriseNameAndPhone.name}}</text>
					<image src="/static/images/middle_icon_next@2x.png" mode="widthFix"></image>
				</view>
				<view class="list-item clearfix" v-for="(item,index) in details.packageItemVoList" :key="item.id">
					<view class="fl">
						<view class="tit">
							{{index+1}}.{{item.business.name}}
							<text>X{{item.times}}</text>
						</view>
						<view>{{item.business.description}}</view>
					</view>
					<view class="fr">¥{{item.price}}</view>
				</view>
			</view>
		</view>
		<!-- end -->

		<!-- nav -->
		<view class="hei-156"></view>
		<details-footer :meal="meal" :nat = 'details'></details-footer>
		<!-- end -->
	</view>
</template>

<script>
import PublicHeader from '@/components/PublicHeader.vue';
import DetailsFooter from '@/components/DetailsFooter.vue';
import app from "@/App.vue"
// var App = getApp()
export default {
	components: {
		PublicHeader,
		DetailsFooter
	},
	data() {
		return {
			sid: '',
			title: '套餐详情',
			share: true,
			meal:true,
			details:''
		};
	},
	onLoad(option){
		if (option && option.sid) {
			this.sid = option.sid
		} else if (app.globalData.query.sid) {
			this.sid = app.globalData.query.sid
		}
		var _this = this
		_this.$http
			.get('/package/getpacakgedetail/' + _this.sid,{
			})
			.then(function(response) {
				_this.details = response.data
			})
			.catch(function(error) {
				console.log(error);
			});
	},
	// #ifdef MP-WEIXIN
	onShareAppMessage(res) {
		let _this = this
		 if (res.from === 'button') {// 来自页面内分享按钮
		   console.log(res.target)
		 }
		 console.log('分享数据',res)
		 // uni.showToast({
			// icon: 'none',
			// position: 'bottom',
			// title: '分享成功'
		 // })
		 return {
		   title: 'Bee到套餐分享',
		   path: '/pages/details/details-meal?sid=' + this.sid,
		   imageUrl: '/static/images/img_0.png'
		 }
	 },
	onShareTimeline(res) {
		let _this = this
		if (res.from === 'menu') {// 来自页面内分享按钮
		  console.log(res.target)
		}
		console.log('分享朋友圈进来的',res)
		uni.showToast({
					icon: 'none',
					position: 'bottom',
					title: '分享成功'
		})
		return {
		  title: 'Bee到套餐分享',
		   path: '/pages/details/details-meal?sid=' + this.sid,
		  imageUrl: '/static/images/img_0.png'
		}
	},
	  // #endif
	methods: {}
};
</script>

<style scoped lang="scss">
.details .banner {
	width: 686rpx;
	height: 246rpx;
	border-radius: 10rpx;
	margin-bottom: 30rpx;
}
.details .cont .title {
	color: #333333;
	font-size: 32rpx;
	line-height: 45rpx;
	margin-bottom: 20rpx;
}
.details .cont .text {
	color: #666;
	font-size: 26rpx;
	line-height: 37rpx;
	margin-bottom: 20rpx;
}
.details .cont .price {
	color: #ff3428;
	font-size: 32rpx;
	line-height: 45rpx;
	margin-bottom: 53rpx;
}
.details .cont .price text {
	font-size: 26rpx;
	color: #666;
}
.list .name {
	font-size: 28rpx;
	color: #333;
	line-height: 40rpx;
	position: relative;
	margin-bottom: 28rpx;
}
.list .name image {
	position: absolute;
	width: 13rpx;
	top: 10rpx;
}
.list .list-item {
	min-height: 80rpx;
	border-bottom: 1rpx solid #dfdfdf;
	padding: 20rpx 0;
	font-size: 24rpx;
	color: #999;
	line-height: 33rpx;
}
.list .list-item .tit {
	font-size: 28rpx;
	color: #333;
	line-height: 40rpx;
	margin-bottom: 10rpx;
}
.list .list-item .fr {
	font-size: 32rpx;
	line-height: 45rpx;
	color: #ff3428;
	margin-top: 19rpx;
}
.hei-156 {
	height: 156rpx;
}
</style>
